let [result_, posX, posY_] = this.transform_stage_point(absItemX, 0);
let [containerWidth] = this.get_transformed_size();
if (posX + this._items[index].get_width() > containerWidth)
- this._scrollToRight();
+ this._scrollToRight(index);
else if (this._items[index].allocation.x1 - value < 0)
- this._scrollToLeft();
+ this._scrollToLeft(index);
}
- _scrollToLeft() {
+ _scrollToLeft(index) {
let adjustment = this._scrollView.hscroll.adjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
- let item = this._items[this._highlighted];
+ let item = this._items[index];
if (item.allocation.x1 < value)
value = Math.min(0, item.allocation.x1);
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: POPUP_SCROLL_TIME,
onComplete: () => {
- if (this._highlighted == 0)
+ if (index === 0)
this._scrollableLeft = false;
this.queue_relayout();
},
});
}
- _scrollToRight() {
+ _scrollToRight(index) {
let adjustment = this._scrollView.hscroll.adjustment;
let [value, lower_, upper, stepIncrement_, pageIncrement_, pageSize] = adjustment.get_values();
- let item = this._items[this._highlighted];
+ let item = this._items[index];
if (item.allocation.x1 < value)
value = Math.max(0, item.allocation.x1);
progress_mode: Clutter.AnimationMode.EASE_OUT_QUAD,
duration: POPUP_SCROLL_TIME,
onComplete: () => {
- if (this._highlighted == this._items.length - 1)
+ if (index === this._items.length - 1)
this._scrollableRight = false;
this.queue_relayout();
},